﻿<Window x:Class="ClearMine.Dialogs.PluginsDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:f="clr-namespace:ClearMine.Framework;assembly=ClearMine.Framework"
        ShowInTaskbar="False"
        WindowStartupLocation="CenterOwner"
        TextOptions.TextFormattingMode="Display"
        Background="{DynamicResource DialogBackground}"
        Style="{DynamicResource MainWindowStyle}"
        Title="{DynamicResource PluginDialogTitle}" Height="300" Width="500">
    <Window.Resources>
        <Style x:Key="ItemContainerStyle"
               TargetType="{x:Type ListViewItem}"
               BasedOn="{StaticResource {x:Static GridView.GridViewItemContainerStyleKey}}">
            <Setter Property="ToolTip" Value="{Binding Description}" />
        </Style>
    </Window.Resources>
    <Window.CommandBindings>
        <x:Static Member="f:UICommandBindings.CloseBinding" />
        <x:Static Member="f:UICommandBindings.MaximizeBinding" />
        <x:Static Member="f:UICommandBindings.MinimizeBinding" />
    </Window.CommandBindings>
    <DockPanel Margin="12"
               DataContext="{Binding Plugins}">
        <ListView Margin="0,0,7,0" ItemsSource="{Binding}"
                  IsSynchronizedWithCurrentItem="True"
                  ItemContainerStyle="{StaticResource ItemContainerStyle}">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="{DynamicResource PluginNameColumnTitle}"
                                    DisplayMemberBinding="{Binding Name}" />
                    <GridViewColumn Header="{DynamicResource PluginIsEnabledColumnTitle}" >
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox IsChecked="{Binding IsEnabled}"
                                          HorizontalAlignment="Center" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
        <DockPanel DataContext="{Binding /}">
            <Label DockPanel.Dock="Top"
                   Margin="0,0,0,5"
                   Content="{DynamicResource PluginPropertiesPanelLabel}" />
            <DataGrid ItemsSource="{Binding Options}"
                      AutoGenerateColumns="False"
                      CanUserAddRows="False"
                      CanUserDeleteRows="False"
                      CanUserResizeRows="False"
                      RowHeaderWidth="0">
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Name}" IsReadOnly="True"
                                        Header="{DynamicResource PluginPropertyNameColumnTitle}">
                        <DataGridTextColumn.ElementStyle>
                            <Style TargetType="{x:Type TextBlock}">
                                <Setter Property="VerticalAlignment" Value="Center" />
                                <Setter Property="Padding" Value="5,0,5,0"/>
                            </Style>
                        </DataGridTextColumn.ElementStyle>
                    </DataGridTextColumn>
                    <DataGridTemplateColumn Header="{DynamicResource PluginPropertyValueColumnTitle}">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Value}" Padding="3" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                        <DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding Value, Mode=TwoWay}" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellEditingTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid>
        </DockPanel>
    </DockPanel>
</Window>
